package com.usian.admin.job;

import com.usian.admin.feign.WemediaFeign;
import com.usian.admin.service.WemediaNewsAutoScanService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class WeMediaNewsAutoScanJob {

    @Autowired
    private WemediaFeign wemediaFeign;
    @Autowired
    private WemediaNewsAutoScanService wemediaNewsAutoScanService;


    @XxlJob("zidongfabu")
    public ReturnT<String> hello(String param) throws Exception {

        //远程调用查询出来待发布的文章
        List<Integer> shenheList = wemediaFeign.findNewsListShenhe();
        for (Integer id : shenheList) {
            wemediaNewsAutoScanService.autoScanByMediaNewsId(id);
        }

        System.out.println("自媒体文章审核调度任务执行结束....");
        return ReturnT.SUCCESS;
    }

}
